home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5240 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.3 KB

  1. Path: in1.uu.net!tandem!usenet
  2. From: Anatoli Mandelchtam <tolik@tarley_pc.loc201.tandem.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: READ THIS!!!!!!!!!!!
  5. Date: Fri, 02 Feb 1996 21:53:28 -0800
  6. Organization: Tandem Computers Inc., Cupertino, CA
  7. Message-ID: <3112F858.1E46@tarley_pc.loc201.tandem.com>
  8. References: <4em5fs$a86@ixnews4.ix.netcom.com> <4er65q$d8v@usenet1.sjc.in.sel.sony.com>
  9. NNTP-Posting-Host: miket_home1.fnord.tandem.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b5 (Win95; I)
  14.  
  15. Victor Marilao wrote:
  16. .> 
  17. .> jeremyx@ix.netcom.com(Jeremy Johnston ) wrote:
  18. .> >
  19. .> >  ok....now that I have your attention i need some help.
  20. .> >I can't get the following command to work & the compiler says that the
  21. .> >constant has too many characters.
  22. .> >
  23. .> >  char dos;
  24. .> >    if(dos=='dir')
  25. .> >    goto b;
  26. .> >
  27. .> >How can i do this to get it to work? please help,I know you can.
  28. .> >
  29. .> >
  30. .> 
  31. .> Try this:
  32. .> 
  33. .> #include "stdio.h"
  34. .> #include "string.h"
  35. .> 
  36. .> main()
  37. .> {
  38. .>     char *dos;
  39. .> //  strcpy(dos, "dir");  // Uncomment to test for a valid
  40. .> match
  41. .> 
  42. .>     if (strcmp(dos, "dir") == 0)
  43. .>         printf("Its a match");
  44. .> }
  45. .> 
  46. .> E-mail me if you need an explanation.
  47. .> 
  48. .> Victor
  49.  
  50. Memory! How about allocating some memory so that "dos" pointer doesn't point
  51. nowhere?
  52.